package psn.zjk.spring.utils;

import com.fasterxml.jackson.databind.ObjectMapper;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

/**
 * @USER white
 * @DATETIME 2020/11/24 22:41
 */
public class JacksonUtils {
    public static final Logger LOGGER = LoggerFactory.getLogger(JacksonUtils.class);

    public static String object2Json(Object object) {
        String out=null;
        try {
            ObjectMapper objectMapper = new ObjectMapper();
            out=objectMapper.writeValueAsString(object);
        } catch (Exception e) {
            LOGGER.error("", e);
        }
        return out;
    }
}
